<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>单例模式</title>
  </head>
  <body>
    <input type="text" class="inp" />
    <div id="loginBtn">登录</div>

    <style>
      .container {
        width: 500px;
        white-space: nowrap;
        /* overflow: auto; */
      }
      .flex-wrapper {
        /* display: flex; */
        /* flex-wrap: nowrap; */
        /* width: 700px; */
        /* gap: 10px; */
        /* white-space: nowrap;
        word-wrap: break-word;
        word-break: break-all; */
        height: 400px;
        background-color: antiquewhite;
        /* white-space: nowrap; */
        overflow: auto;
      }
      .flex-wrapper > span {
        display: inline-block;
        width: 200px;
        background-color: rgb(125, 99, 59);
      }
    </style>
    <div class="container">
      <div class="flex-wrapper">
        <span>aaa</span>
        <span>bbb</span>
        <span>ccc</span>
        <span>ddd</span>
        <span>eee</span>
      </div>
    </div>

    <script src="./index.js"></script>
    <script>
      const inp = document.querySelector('.inp');
      let isC = false;
      const search = function (e) {
        if (!isC) {
          console.log('搜索');
        }
      };
      inp.addEventListener('input', search);
      inp.addEventListener('compositionstart', function (e) {
        isC = true;
      });
      inp.addEventListener('compositionend', function (e) {
        isC = false;
        search();
      });
    </script>
  </body>
</html>
